package main.java.fireStrategy;

import main.java.Bullet;
import main.java.Tank;

public class DefaultStrategy implements main.java.fireStrategy.FireStrategy {

    private DefaultStrategy(){}

    private static class DefaultStrategyHolder {
        private final static DefaultStrategy INSTANCE = new DefaultStrategy();
    }

    public static DefaultStrategy getInstance() {return DefaultStrategyHolder.INSTANCE;}

    @Override
    public void fire(Tank t) {
        int bX = t.getX() + Tank.WIDTH / 2 - Bullet.WIDTH / 2;
        int bY = t.getY() + Tank.HEIGHT / 2 - Bullet.HEIGHT / 2;
        new Bullet(bX, bY, t.getDir(), t.getGroup(), t.getTf());
    }
}
